﻿package com.tvein.sanguo.swc.action.menu
{
	//flash
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	//A3D
	//custom
	import com.tvein.sanguo.swc.common.MP3Click;
//
	public class MenuButton extends MovieClip
	{
		public static const NAME:String = "Menu-Button";

		private var effectVol:int;
		
		public function MenuButton(vol:int = 100)
		{
			txtName.selectable = false;
			txtName.mouseEnabled = false;
			
			effectVol = vol;
			
			btnButton.visible = true;
			btnButton.addEventListener(MouseEvent.CLICK, onClick);
		}

		public function setVisible(values:Boolean):void
		{
			btnButton.visible = values;
		}

		public function setTitle(values:String):void
		{
			txtName.htmlText = values;
		}

		private function onClick(evt:MouseEvent):void
		{
			var soundEffect:MP3Click = new MP3Click();
			soundEffect.playback(effectVol * .01);

			dispatchEvent(new Event("CLICK"));
		}
	}
}